Skip to content

[Visibility] Deprecate ChangeConstantVisibilityRector as too niche and risky - #8767

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-change-constant-visibility
Oct 22, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
deprecate-change-constant-visibility

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

ChangeConstantVisibilityRector is too niche and never used in practice.

Changing a constant visibility against its parent class needs extra care to not break the code, e.g. widening a parent's protected constant to public on a child, or the reverse that can make an inherited constant inaccessible.

For such a case, a custom rule tailored to the concrete constants and classes is safer than this generic one.

Follows the usual full-retirement pattern: marks the rule @deprecated + DeprecatedInterface, guts the body to throw, drops the now-unused ChangeConstantVisibility value object and the rule test.

@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 22, 2026 11:13
@TomasVotruba
TomasVotruba merged commit 8546172 into main Oct 22, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-change-constant-visibility branch October 22, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant